package com.subway.babynote;
/*水*/
import com.subway.babynote.syncservice.syncapi;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Button;

public class notefinish extends Activity {
	private static final int INVISIBLE = 0x00000004;
	TextView note_view;
	TextView time_view;
	TextView food_view;
	Button login_button;
	Button continuenote_button;
	Button finishnote_button;
    Bundle bundle;
    NotedbHelper notedb;
    private LinearLayout linearLayout, statistics, sync, more;
    Intent In;
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.notefinish);
		In=new Intent();
	//	initTabFunction();
		continuenote_button = (Button) findViewById(R.id.continuenote_button);
		finishnote_button = (Button) findViewById(R.id.finishnote_button);
		login_button = (Button) findViewById(R.id.login_button);
		time_view = (TextView) findViewById(R.id.timeinfo_view);
		note_view = (TextView) findViewById(R.id.noteinfo_view);
		food_view = (TextView) findViewById(R.id.noted_view);
		bundle = this.getIntent().getExtras();
		time_view.setText(bundle.getString("timestamp"));
		note_view.setText(bundle.getString("amount"));
		food_view.setText(bundle.getString("foodname"));
		//note_view.setText("testabc");
		notedb = new NotedbHelper(this);
		try {
			if (syncapi.getSyncImpl().getUserid() != -1) {
				login_button.setVisibility(INVISIBLE);
				login_button.setClickable(false);
			}
		} catch (Exception e) {
			Log.v("notefinish", "from DB e=" + e.getMessage());
		}
		continuenote_button.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				
				In.setClass(notefinish.this, maintab.class);
				startActivity(In);
				notefinish.this.finish();
			}
		});
		finishnote_button.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
			
				In.setClass(notefinish.this, perdaytab.class);
				startActivity(In);
				notefinish.this.finish();
			}
		});
		login_button.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
			
				In.setClass(notefinish.this, login.class);
				startActivity(In);
			}
		});

	}
	
	
	public void onDestroy(){
		   notedb.close();
		   super.onDestroy();	  	   
		   
		}
}